#ifndef BENDILIST_H
#define BENDILIST_H

#include "mydata.h"

// 初始化班次链表
TrainList* initTrainList();

// 从JSON文件加载班次数据到链表
int loadTrainsFromFile(TrainList *list, const char *filename);

// 保存链表数据到JSON文件
int saveTrainsToFile(TrainList *list, const char *filename);

// 添加班次到链表
void addTrain(TrainList *list, Train *train);

// 根据车次号查找班次
Train* findTrain(TrainList *list, const char *trainNumber);

// 释放链表内存
void freeTrainList(TrainList *list);

// 座位状态操作函数
int reserveSeat(Train *train, int seatType, int seatIndex);
int freeSeat(Train *train, int seatType, int seatIndex);
int toggleSeatStatus(Train *train, int seatType, int seatIndex);

#endif // BENDLIST_H